<?php

class ProductModel extends Model {
	public $info;

	public function r( $id=0 ) {
		$info = $this->find( $id );
		$userMD = D( 'Plat/User' );
		$commMD = D( 'Mall/ProductComment' );
		$userTN = $userMD->trueTableName;
		$commTN = $commMD->trueTableName;
		$info['comment'] = $commMD->field( "$userTN.id, $userTN.name, $commTN.id, $commTN.cont, $commTN.user_id" )
								  ->join( "$userTN ON $userTN.id=$commTN.user_ID" )
								  ->where( "product_id=$id" )
								  ->select();		
		$this->info = $info;
		return $info;
	}
	
	public function getList() {		
		$this->info = $this->select();
		return $this->info;
	}
}

